package com.qianfeng.controller.swagger;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/*
 *@Description:
 *@author:刘哥
 *@Date:86180 2022/9/15 20:42
 */
@EnableSwagger2//开启swagger
@Configuration//配置类
public class SwaggerConfig {
    @Bean
    public Docket api(ApiInfo apiInfo) {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
//                .apis(RequestHandlerSelectors.any())
//                生成文档的对象
                .apis(RequestHandlerSelectors.basePackage("com.qianfeng.controller"))
                .build()
                .apiInfo(apiInfo);
    }
    @Bean
    public ApiInfo apiInfo() {
        return new ApiInfoBuilder()
//                配置文档的名称
                .title("智能设备管理项目接口文档")
                .description("智能设备管理项目接口测试")
//                版本号
                .version("1.0.0")
//                团队服务地址
                .termsOfServiceUrl("")

                .license("Apache2.0")
//                licenseUrl地址
                .licenseUrl("http://httpd.apache.org/docs/2.0/license.html")
                .build();
    }
}
